<?php
namespace app\tripapi\controller;
use think\Controller;
use think\Request;
use think\Db;

class test extends ApiBaseController{
    public function __construct(){
        parent::__construct();
    }

    public function index(){
        $result = Db::table('user')->field('UID,USER_NAME,DEPT_ID')->select();
        foreach($result as $key => $value){
            $data['uid'] = $value['UID'];
            $data['pid'] = $value['DEPT_ID'];
            Db::name('new_user')->where('user_name', '=', $value['USER_NAME'])->update($data);
        }
    }


}
?>